//
//  Zixuangu.swift
//  股票框架
//
//  Created by 李小骥 on 2017/10/16.
//  Copyright © 2017年 李小骥. All rights reserved.
//

import UIKit



class Zixuangu: NSObject {
    var gupiaos:[Gupiao] = []
    var codes:[String] = []{
        willSet{
            collectedCodes = newValue
        }
    }
    override init() {
        super.init()
//        1.从userDefault 读取
        let fileManager = FileManager.default
        let filePath:String = NSHomeDirectory() + "/Documents/zixuangu.data"
        let exist = fileManager.fileExists(atPath: filePath)
        
        if(exist == true){
            if let codeArr = NSKeyedUnarchiver.unarchiveObject(withFile: filePath){
                codes = codeArr as! [String]
            }
        }
//        2.获取 codes不空时，依次申请数据，设计回调
        
    }
}

